package com.oazon.moco.link.ui;

import android.util.Log;

import com.oazon.moco.link.core.LinkEvent;
import com.oazon.moco.link.core.LinkEventListener;
import com.oazon.moco.link.core.source.LinkEventSource;
import com.oazon.moco.link.event.SystemStateEvent;
import com.oazon.moco.link.event.UpdateEvent;
import com.oazon.moco.link.event.UpdateStatus;

/**
 * Created by win 7 on 2015/6/16.
 */
public class UpdateEventListener extends LinkEventListener {
    @Override
    public void onLinkEvent(LinkEvent event) {
        if (filter((LinkEventSource) event.getSource())
                || !(event instanceof UpdateEvent)) {
            return;
        }

        UpdateEvent e = (UpdateEvent) event;
        if (e.getState() == UpdateStatus.PRE_UPDATE) {
            beforeUpdate();
        } else if(e.getState() == UpdateStatus.AFTER_UPDATE) {
            afterUpdate();
        }

    }

    protected void beforeUpdate() {

    }

    protected void afterUpdate() {
    }
}
